package com.quantanetwork.esm.port;

import javax.sql.DataSource;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;

/**
 * 系统启动 在Spring框架中初始化jdbc模板
 * 
 * @author zyl
 * 
 */
public class SpringJDBC
{
	public DataSource dataSource;
	public static JdbcTemplate jdbc;
	public static NamedParameterJdbcTemplate parameterJdbcTemplate;

	public DataSource getDataSource()
	{
		return dataSource;
	}

	public void setDataSource(DataSource dataSource)
	{
		this.dataSource = dataSource;
		SpringJDBC.jdbc = new JdbcTemplate(dataSource);
		SpringJDBC.parameterJdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
	}

	public static JdbcTemplate getJdbc()
	{
		return SpringJDBC.jdbc;
	}

	public void setJdbc(JdbcTemplate jdbc)
	{
		SpringJDBC.jdbc = jdbc;
	}
}
